package com.zxk.weixinpay.controller.admin;

import com.zxk.weixinpay.domain.Video;
import com.zxk.weixinpay.service.VideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "管理员接口")
@RestController
@RequestMapping("/admin/api/v1/video")
public class VideoAdminController {

    @Autowired
    private VideoService videoService;
    /**
     * 更新视频通过id值
     * @param video
     * @return
     */
    @ApiOperation(value = "更新视频内容",notes = "视频")
    @PutMapping("update_by_id")
    public int updateVideo(@RequestBody Video video) {

        return videoService.update(video);
    }

    @ApiOperation(value = "新增视频")
    @PostMapping("save")
    public int save(@RequestBody Video video) {
        return videoService.save(video);
    }

    @ApiOperation(value = "通过id值删除相应的视频")
    @DeleteMapping("del_by_id")
    public int del(@ApiParam("视频id值") @RequestParam(value = "value_id",required = true) Integer id) {
        return videoService.del(id);
    }

}
